<?php
/* --------------------------------------------------------------
   customer_registration_date_migration.php 2023-02-10
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2023 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   -------------------------------------------------------------
*/

/** @var DatabaseModel $this */
/** @var int $t_success */

/**
 * setting customers_date_added for main admin to installation date of the shop
 */
$shopInstallationQuery = 'SELECT `installation_date` FROM `version_history` WHERE `is_full_version` = 1';
$shopInstallationDate  = $this->query($shopInstallationQuery)[0]['installation_date'];
$shopAdminUpdateQuery  = "UPDATE `customers`
                            SET `customers_date_added` = '$shopInstallationDate'
                            WHERE
                                `customers_id` = 1 AND
                                `customers_date_added` = '1000-01-01 00:00:00'";
$t_success             &= $this->query($shopAdminUpdateQuery, true);
